def setup
  size 200, 200
  
  coswave = (0 .. width).map do |i|
    ratio = i.to_f / width
    abs(cos(ratio*PI))
  end
  
  coswave.each_with_index do |v, i|
    stroke v * 255
    line i, 0, i, width / 3
  end
  
  coswave.each_with_index do |v, i|
    stroke v * 255 / 4
    line i, width / 3, i, width / 3 * 2
  end
  
  coswave.each_with_index do |v, i|
    stroke 255 - v * 255
    line i, width / 3 * 2, i, height
  end
end